package com.leo.blog.service;

import java.util.List;
import java.util.Map;

import com.leo.blog.dto.BlogExecution;
import com.leo.blog.dto.ImageHolder;
import com.leo.blog.entity.Blog;
import com.leo.blog.exceptions.BlogOperationException;

public interface BlogService {
	/**
	 * 返回类型前N条数据
	 * @return
	 */
	Map<String, List<Blog>> getBlogByAllType();
	
	/**
	 * 更新文章信息
	 * @param blog
	 * @return
	 * @throws BlogOperationException
	 */
	BlogExecution modifyBlog(String name, Blog blog) throws BlogOperationException;
	BlogExecution modifyBlogClickNum(String name, Blog blog) throws BlogOperationException;
	
	/**
	 * 根据blogId获取文章信息
	 * @param blogId
	 * @return
	 */
	Blog getByBlogId(int blogId);
	/**
	 * 根据id查询前后文章
	 * @param blogId
	 * @return
	 */
	Blog getBlogByIdPreAndNext(int blogId);
	/**
	 * 获取最大的id
	 * @return
	 */
	int getBlogByMaxId();
	
	/**
	 * 根据条件获取文章信息
	 * @param blogCondition
	 * @param pageIndex
	 * @param pageSize
	 * @return
	 */
	public BlogExecution getBlogList(Blog blogCondition, int pageIndex, int pageSize);
	
	public BlogExecution getBlogListClick(Blog blogCondition, int pageIndex, int pageSize);
	
	/**
	 * 发表文章
	 * @param blog
	 * @return
	 * @throws BlogOperationException
	 */
	BlogExecution addBlog(String name, Blog blog) throws BlogOperationException;
	
	/**
	 * 获取状态各类型总数
	 * @return
	 */
	List<Blog> getBlogCountByStatus();
	
	/**
	 * 上传图片
	 * @param blogerId
	 * @param thumbnail
	 * @return
	 */
	String uploadBlogImages(String name, int blogerId, ImageHolder thumbnail);
	
	/**
 	 *  获取博客信息，根据日期月份分组查询
 	 * @return
 	 */
	BlogExecution  getBlogListByDate(Blog blogCondition);
	
	BlogExecution getBlogListByStatus();

 	/**
 	 *  获取博客信息，根据状态分组查询
 	 * @return
 	 */
	BlogExecution getBlogByClick();
}
